<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import = "com.myweb.DBTools" %>
<%

request.setCharacterEncoding("utf-8");
String dish_id = request.getParameter("dish_id");
String name = request.getParameter("name");
String price = request.getParameter("price");
String btn = request.getParameter("btn");

//构造SQL
String sql = "";
//insert
sql = "insert into dishes(name,price)values('"+name+"','"+price+"')";

if("修改".equals(btn)){
	//update
	sql = "update dishes set name='" +name +"',price='" + price+ "where dish_id="+ dish_id;
}else if("del".equals(btn)){
	//delete
	sql = "delete from dishes where  dish_id="+ dish_id + "";
}

//执行SQL
int ret = com.myweb.DBTools.update(sql);
System.out.println("ret="+ret);

response.sendRedirect("Menu Management.jsp");
%>